import Bayes.bayes as bys
import re

'''
    # 测试函数
'''
def ceshi1():
    listOPosts, listClasses = bys.loadDateSet()
    myVocabList = bys.createVocabList(listOPosts)
    #print(myVocabList)
    print(bys.setOfWords2Vec(myVocabList, listOPosts[3]))

def ceshi2():
    listOPosts, listClasses = bys.loadDateSet()
    myVocabList = bys.createVocabList(listOPosts)
    trainMat = []
    for postinDoc in listOPosts:
        trainMat.append(bys.setOfWords2Vec(myVocabList, postinDoc))
    p0V, p1V, pAbuse = bys.trainNB0(trainMat, listClasses)
    print(p0V)
    print(p1V)

def ceshi3():
    bys.testingNB()

def ceshi4():
    mySent = 'This book is the best book on Python or M.L. I have ever laid eyes upon.'
    # print(mySent.split())
    regEx = re.compile('\\W*')
    listOfTokens = regEx.split(mySent)
    print(listOfTokens)

def ceshi5():
    print(bys.spamTest())

if __name__ == '__main__':
    ceshi5()
